!! test
Table attributes with empty value
!! options
-disabled
+parsoid
!! input
{|
| style=| hello
!! test
Unbalanced closing block tags break a list
-(Disabled since php parser generates broken html -- relies on Tidy to fix up)
+(Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
!! options
-disabled
+parsoid
!! input
<div>
*a</div><div>
!! test
Unbalanced closing non-block tags don't break a list
-(Disabled since php parser generates broken html -- relies on Tidy to fix up)
+(Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
!! options
-disabled
+parsoid
!! input
<span>
*a</span><span>
!! test
Unclosed formatting tags that straddle lists are closed and reopened
-(Disabled since php parser generates broken html -- relies on Tidy to fix up)
+(Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
!! options
-disabled
+parsoid
!! input
# <s> a
# b </s>
Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
(PHP parser generates misnested html)
!! options
-disabled
+parsoid
!!input
{{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
!!result
Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
(PHP parser generates misnested html)
!! options
-disabled
+parsoid
!!input
{{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
!!result
!! test
div with empty attribute value, space before equals
!! options
-disabled
+parsoid
!! input
<div class =>HTML rocks</div>
!! result
!! test
div with braces in attribute value
!! options
-disabled
+parsoid
!! input
<div title="{}">Foo</div>
!! result
!! test
div with empty attribute value, no space before equals
!! options
-disabled
+parsoid
!! input
<div class=>HTML rocks</div>
!! result
!!test
1. SOL-sensitive wikitext tokens as template-args
!!options
-disabled
+parsoid
!!input
{{echo|*a}}
{{echo|#a}}
!!end
#### The following section of tests are primarily to test
-#### wikitext escaping capabilities of Parsoid.
-#### A lot of the tests are disabled for the PHP parser either
-#### because of minor newline diffs or other reasons.
-#### As Parsoid serializer can handle newlines and other HTML
-#### more robustly, some of these tests might get reenabled
-#### for the PHP parser.
+#### wikitext escaping capabilities of Parsoid. Given that
+#### escaping can be done any number of ways, the wikitext (input)
+#### is always adjusted to reflect how Parsoid adds nowiki
+#### escape tags.
+####
+#### We are marking several tests as parsoid-only since the
+#### HTML in the result section is different from what the
+#### PHP parser generates for it.
+
#### --------------- Headings ---------------
#### 0. Unnested
#### ----------------------------------------
!! test
Headings: 0. Unnested
+!! options
+parsoid
!! input
<nowiki>=foo=</nowiki>
-<nowiki>=foo</nowiki>''a''=
+<nowiki> =foo= </nowiki>
+<!--cmt-->
+<nowiki>=foo=</nowiki>
+
+=foo''a''<nowiki>=</nowiki>
!! result
<p>=foo=
+</p><p> =foo=
+</p><p><!--cmt-->=foo=
</p><p>=foo<i>a</i>=
</p>
!!end
!! test
Headings: 1. Nested inside html
!! options
-disabled
+parsoid
!! input
=<nowiki>=foo=</nowiki>=
==<nowiki>=foo=</nowiki>==
!! test
Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
!! options
-disabled
+parsoid
!! input
=foo=
<nowiki>*bar</nowiki>
!! test
Headings: 3. Nested inside html with wikitext split by html tags
!! options
-disabled
+parsoid
!! input
-=<nowiki>=</nowiki>'''bold'''foo==
+=='''bold'''<nowiki>foo=</nowiki>=
!! result
<h1>=<b>bold</b>foo=</h1>
!!end
!! test
-Headings: 4. No escaping needed (testing just h1 and h2)
+Headings: 4a. No escaping needed (testing just h1 and h2)
!! options
-disabled
+parsoid
!! input
==foo=
=foo==
+= =foo= =
+==foo= bar=
===foo==
==foo===
=''=''foo==
-===
+=<nowiki>=</nowiki>=
!! result
<h1>=foo</h1>
<h1>foo=</h1>
+<h1> =foo= </h1>
+<h1>=foo= bar</h1>
<h2>=foo</h2>
<h2>foo=</h2>
<h1><i>=</i>foo=</h1>
<h1>=</h1>
+
+!!end
+
+!! test
+Headings: 4b. No escaping needed (inside p-tags)
+!! options
+parsoid
+!! input
+===
+=foo= x
+=foo= <s></s>
+!! result
+<p>===
+=foo= x
+=foo= <s></s>
+</p>
!!end
!! test
Headings: 5. Empty headings
!! options
-disabled
+parsoid
!! input
-=<nowiki></nowiki>=
-==<nowiki></nowiki>==
-===<nowiki></nowiki>===
-====<nowiki></nowiki>====
-=====<nowiki></nowiki>=====
-======<nowiki></nowiki>======
+=<nowiki/>=
+==<nowiki/>==
+===<nowiki/>===
+====<nowiki/>====
+=====<nowiki/>=====
+======<nowiki/>======
!! result
<h1></h1>
<h2></h2>
!! test
Headings: 6. Heading chars in SOL context
!! options
-disabled
+parsoid
!! input
<!--cmt--><nowiki>=h1=</nowiki>
+<!--cmt--><nowiki> =h1= </nowiki>
!! result
<p><!--cmt-->=h1=
+<!--cmt--> =h1=
</p>
!!end
!! test
Lists: 4. No escapes needed
!! options
-disabled
+parsoid
!! input
*foo*bar
*[[bar <span><nowiki>[[foo]]</nowiki></span>
-*<nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
+*]]bar <span><nowiki>[[foo]]</nowiki></span>
*=bar <span>foo]]</span>=
+
+* <s></s>: a
!! result
<ul><li> bar <span>[[foo]]</span>
</li></ul>
</li></ul>
<ul><li>=bar <span>foo]]</span>=
</li></ul>
+<ul><li> <s></s>: a
+</li></ul>
!!end
!! test
Lists: 6. Escape bullets in SOL position
!! options
-disabled
+parsoid
!! input
<!--cmt--><nowiki>*foo</nowiki>
!! result
!! test
HRs: 1. Single line
!! options
-disabled
+parsoid
!! input
-----
-<nowiki>----</nowiki>
-----
-<nowiki>=foo=</nowiki>
-----
-<nowiki>*foo</nowiki>
+----<nowiki>----</nowiki>
+----=foo=
+----*foo
!! result
<hr/>----
<hr/>=foo=
!! test
Tables: 2a. Nested in td
!! options
-disabled
+parsoid
!! input
{|
|<nowiki>foo|bar</nowiki>
!! test
Tables: 2b. Nested in td
!! options
-disabled
+parsoid
!! input
{|
|<nowiki>foo||bar</nowiki>
!! test
Tables: 2c. Nested in td -- no escaping needed
!! options
-disabled
+parsoid
!! input
{|
|foo!!bar
!! test
Tables: 3a. Nested in th
!! options
-disabled
+parsoid
!! input
{|
!foo!bar
!! test
Tables: 3b. Nested in th
!! options
-disabled
+parsoid
!! input
{|
!<nowiki>foo!!bar</nowiki>
!! test
Tables: 3c. Nested in th -- no escaping needed
!! options
-disabled
+parsoid
!! input
{|
-!foo||bar
+!<nowiki>foo||bar</nowiki>
|}
!! result
<table>
!! test
Tables: 4a. Escape -
!! options
-disabled
+parsoid
!! input
{|
|-
!! test
Tables: 4b. Escape +
!! options
-disabled
+parsoid
!! input
{|
|-
!! test
Tables: 4c. No escaping needed
!! options
-disabled
+parsoid
!! input
{|
|-
</tbody></table>
!! end
+### SSS FIXME: Disabled right now because accurate html2wt
+### on this snippet requires data-parsoid flags that we've
+### stripped out of these tests. We should scheme how we
+### we want to handle these kind of tests that require
+### data-parsoid flags for accurate html2wt serialization
+
!! test
Tables: 4d. No escaping needed
+!! options
+disabled
!! input
{|
||+1
!! test
Links 1. Quote marks in link text
!! options
-disabled
+parsoid
!! input
[[Foo|<nowiki>Foo''boo''</nowiki>]]
!! result
!! test
Links 2. WikiLinks: Escapes needed
!! options
-disabled
+parsoid
!! input
[[Foo|<nowiki>[Foobar]</nowiki>]]
[[Foo|<nowiki>Foobar]</nowiki>]]
-[[Foo|<nowiki>x [Foobar] x</nowiki>]]
+[[Foo|x [Foobar] x]]
[[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
[[Foo|<nowiki>[[Bar]]</nowiki>]]
[[Foo|<nowiki>x [[Bar]] x</nowiki>]]
[[Foo|<nowiki>|Bar</nowiki>]]
+[[Foo|<nowiki>]]bar</nowiki>]]
+[[Foo|<nowiki>[[bar</nowiki>]]
+[[Foo|<nowiki>x ]] y [[ z</nowiki>]]
!! result
<a href="Foo" rel="mw:WikiLink">[Foobar]</a>
<a href="Foo" rel="mw:WikiLink">Foobar]</a>
<a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
<a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
<a href="Foo" rel="mw:WikiLink">|Bar</a>
+<a href="Foo" rel="mw:WikiLink">]]bar</a>
+<a href="Foo" rel="mw:WikiLink">[[bar</a>
+<a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
!! end
!! test
Links 3. WikiLinks: No escapes needed
!! options
-disabled
+parsoid
!! input
[[Foo|[Foobar]]
[[Foo|foo|bar]]
!! test
Links 4. ExtLinks: Escapes needed
!! options
-disabled
+parsoid
!! input
[http://google.com <nowiki>[google]</nowiki>]
[http://google.com <nowiki>google]</nowiki>]
!! test
Links 5. ExtLinks: No escapes needed
!! options
-disabled
+parsoid
!! input
[http://google.com [google]
!! result
[[bar <span><nowiki>[[foo]]</nowiki></span>
-<nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
+]]bar <span><nowiki>[[foo]]</nowiki></span>
-<nowiki>=bar </nowiki><span>foo]]</span>=
+=bar <span>foo]]</span><nowiki>=</nowiki>
!! result
<p>bar <span>[[foo]]</span>
</p><p>=bar <span>[[foo]]</span>
!! test
1. Leading space in SOL context should be escaped
!! options
-disabled
+parsoid
!! input
<nowiki> foo</nowiki>
<!--cmt--><nowiki> foo</nowiki>
!! test
1. a tags
!! options
-disabled
+parsoid
!! input
<a href="http://google.com">google</a>
!! result
<p><nowiki>foo</nowiki>
</p>
!! end
-
!! test
+
Tag-like HTML structures are passed through as text
!! input
<x y>
!! test
Tag names followed by punctuation should not be recognized as tags
!! options
-disabled
+parsoid
!! input
<s.ome> text
!! result